<%--
  Created by IntelliJ IDEA.
  User: fenglixiong
  Date: 2017/10/4
  Time: 1:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
    <title>消息列表</title>
    <script type="text/javascript" src="/static/js/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="/static/js/globalPage.js"></script>
    <script type="text/javascript">
        function loadDate(){
            document.fs.submit();
        }
    </script>
</head>
<body>
<%@include file="../head_include.jsp"%>
<h1>消息列表</h1>
<form name="fs" action="messageList.htm" method="post">
    <input type="hidden" id="page" name="page" value="${ps.page}"/>
    房间号：<input type="text" name="chatId" value="${ps.chatId}"/>
    用户ID：<input type="text" name="userId" value="${ps.userId}"/>
    消息内容：<input type="text" name="content" value="${ps.content}"/>
    <input type="submit" value="搜索"/>
</form>
<table border="1">
    <thead>
    <tr>
        <th>ID</th>
        <th>ChatId</th>
        <th>UserId</th>
        <th>UserName</th>
        <th>Content</th>
        <th>ContentType</th>
        <th>CreateTime</th>
        <th>operate</th>
    </tr>
    </thead>
    <tbody>
    <c:if test="${empty messageList}">
        <tr>
            <td colspan="8">暂无数据！</td>
        </tr>
    </c:if>
    <c:if test="${not empty messageList}">
        <c:forEach items="${messageList}" var="message" varStatus="status">
            <tr>
                <td>${message.id}</td>
                <td>${message.chatId}</td>
                <td>${message.userId}</td>
                <td>${message.userName}</td>
                <td>${message.content}</td>
                <td>${message.contentType}</td>
                <td><fmt:formatDate value="${message.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/> </td>
                <td>
                    <a href="/message/messageDelete.htm?messageId=${message.id}">删除</a>
                </td>
            </tr>
        </c:forEach>
    </c:if>
    </tbody>
</table>
<div>
    <a href="javascript:void(0);" onclick="turnPage(1)">首页</a>
    <a href="javascript:void(0);" onclick="prePage()">上一页</a>
    <a href="javascript:void(0);" onclick="nextPage()">下一页</a>
    <a href="javascript:void(0);" onclick="turnPage('${ps.totalPage}')">尾页</a>
</div>

</body>
</html>
